/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package abricots.entity.state;

/**
 *
 * @author charly
 */
public class PlayerEntityState implements EntityState {
   protected long gameTime;
   protected int entityId;
   protected int score;
   protected int lives;

   public PlayerEntityState() {
      this(-1, -1, 0, 0);
   }

   public PlayerEntityState(int score, int lives) {
      this(-1, -1, score, lives);
   }

   public PlayerEntityState(long gameTime, int entityId, int score, int lives) {
      this.gameTime = gameTime;
      this.entityId = entityId;
      this.score = score;
      this.lives = lives;
   }

   @Override
   public int getEntityId() {
      return entityId;
   }

   @Override
   public long getGameTime() {
      return gameTime;
   }

   public void setEntityId(int entityId) {
      this.entityId = entityId;
   }

   public void setGameTime(long gameTime) {
      this.gameTime = gameTime;
   }

   public void setLives(int lives) {
      this.lives = lives;
   }

   public void setScore(int score) {
      this.score = score;
   }

   @Override
   public EntityState getCopy() {
      return new PlayerEntityState(gameTime, entityId, score, lives);
   }

   @Override
   public boolean equalsRegardlessOfTime(EntityState other) {
      if (other == null) {
         return false;
      }
      PlayerEntityState otherPlayerState = (PlayerEntityState) other;
      if (this.entityId != otherPlayerState.entityId) {
         return false;
      }
      if (this.score != otherPlayerState.score) {
         return false;
      }
      if (this.lives != otherPlayerState.lives) {
         return false;
      }
      return true;
   }

   @Override
   public boolean equals(Object obj) {
      if (obj == null) {
         return false;
      }
      if (getClass() != obj.getClass()) {
         return false;
      }
      final PlayerEntityState other = (PlayerEntityState) obj;
      if (this.gameTime != other.gameTime) {
         return false;
      }
      if (this.entityId != other.entityId) {
         return false;
      }
      if (this.score != other.score) {
         return false;
      }
      if (this.lives != other.lives) {
         return false;
      }
      return true;
   }

   @Override
   public int hashCode() {
      int hash = 7;
      hash = 47 * hash + (int) (this.gameTime ^ (this.gameTime >>> 32));
      hash = 47 * hash + this.entityId;
      hash = 47 * hash + this.score;
      hash = 47 * hash + this.lives;
      return hash;
   }
}
